import java.util.Scanner;

/**
 * Created by dllo on 18/3/31.
 */
public class Test06 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("输入年");
        int years = scanner.nextInt();
        System.out.println("输入月");
        int months = scanner.nextInt();
        System.out.println("输入日");
        int days = scanner.nextInt();
        int sum = 0;
        switch (months) {
            case 12:
                sum = 30 + sum;

            case 11:
                sum = 31 + sum;
            case 10:
                sum = 30 + sum;
            case 9:
                sum = 31 + sum;
            case 8:
                sum = 31 + sum;
            case 7:
                sum = 30 + sum;
            case 6:
                sum = 31 + sum;
            case 5:
                sum = 30 + sum;
            case 4:
                sum = 31 + sum;
            case 3:
                if (years % 4 == 0 && years % 100 != 0 || years % 400 == 0) {
                    sum = 29 + sum;
                } else {
                    sum = 28 + sum;
                }
            case 2:
                sum = 31 + sum;
            case 1:
                sum = sum + days;
        }
        System.out.println(sum);


    }

}

